<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<form id="myForm" class="form-horizontal" action="chushou/add" method="post">
    <input value="${jilu.tushu.chushou}" type="hidden" id="chushou" >
    <input value="${jilu.tushu.ts_id}" type="hidden" id="ts_id" >


    <div class="form-group">
        <label for="jy_id" class="col-sm-3 control-label">单号</label>
        <div class="col-sm-9">
            <input type="text" name="cs_name" value="${jilu.jy_id}" disabled class="form-control" id="jy_id" >
        </div>
    </div>
    <div class="form-group">
        <label for="tu_name" class="col-sm-3 control-label">图书名称</label>
        <div class="col-sm-9">
            <input type="text" name="cs_shouji" value="${jilu.tushu.tu_name}" disabled class="form-control" id="tu_name">
        </div>
    </div>
    <div class="form-group">
        <label for="jieyue" class="col-sm-3 control-label">借阅价格(天)</label>
        <div class="col-sm-9">
            <input type="text" name="cs_shouji" value="${jilu.tushu.jieyue}" disabled class="form-control" id="jieyue">
        </div>
    </div>
    <div class="form-group">
        <label for="jy_jiechu" class="col-sm-3 control-label">借出时间</label>
        <div class="col-sm-9">
            <input type="text" name="cs_shouji" value="${shijian}" disabled class="form-control" id="jy_jiechu">
        </div>
    </div>
    <div class="form-group">
        <label for="guihuan" class="col-sm-3 control-label">归还时间</label>
        <div class="col-sm-9">
            <input type="text" name="cs_shouji"   class="form-control" id="guihuan">
        </div>
    </div>
    <div class="form-group">
        <label for="dz_id" class="col-sm-3 control-label">借书卡卡号</label>
        <div class="col-sm-9">
            <input type="text" name="cs_shouji" disabled value="${jilu.duzhe.dz_id}" class="form-control" id="dz_id">
        </div>
    </div>
    <div class="form-group">
        <label for="dz_name" class="col-sm-3 control-label">读者姓名</label>
        <div class="col-sm-9">
            <input type="text" name="cs_shouji" disabled value="${jilu.duzhe.dz_name}" class="form-control" id="dz_name">
        </div>
    </div>
    <div class="form-group">
        <label for="dz_jine" class="col-sm-3 control-label">余额</label>
        <div class="col-sm-9">
            <input type="text" name="cs_shouji" disabled value="${jilu.duzhe.dz_jine}" class="form-control" id="dz_jine">
        </div>
    </div>

    <div class="form-group">
        <label for="zong" class="col-sm-3 control-label">是否破损</label>
        <div class="col-sm-9">
            <input type="checkbox" name="cs_shouji"  id="posun" onclick="gaibian(this)">
        </div>
    </div>
    <div class="form-group" style="display: none;">
        <label for="fajin" class="col-sm-3 control-label">破损等级</label>
        <div class="col-sm-9">
            <select id="fajin" onchange="chang(this)" class="form-control" >
                <option value="-1">请选择</option>
                <c:forEach items="${requestScope.fajin}" var="a">
                    <option value="${a.baifenbi}">${a.name}</option>
                </c:forEach>
            </select>
        </div>
    </div>



    <div class="form-group">
        <label for="zong" class="col-sm-3 control-label">需付金额</label>
        <div class="col-sm-9">
            <input type="text" name="cs_shouji" disabled class="form-control" id="zong">
        </div>
    </div>
</form>
<script>
    var shi=new Date();
    $("#guihuan").val(shi.toLocaleDateString());
    $("#guihuan").attr("disabled","true");
    var chu=new Date($("#jy_jiechu").val());
    var huan = new Date($("#guihuan").val());

    var cha = Math.ceil((huan - chu) / (1000 * 60 * 60 * 24)) + 1;
    $("#zong").val(cha * parseInt($("#jieyue").val()));



        $("#show").append("<img height='200px' width='200px'id=\"showw\" src=\"\">");
    var book_img = document.getElementById("img").value;
    //  显示要修改的图片
    $("#showw").attr("src",book_img);
    //         单击图片按钮显示出来
    $('#book_img').on('change',function() {
        $("#show").text("");
        //加载选择图片
        var r= new FileReader();
        f=document.getElementById('book_img').files[0];
        r.readAsDataURL(f);
        r.onload=function  (e) {
            $("#show").append("<img width='200px' height='200px' id=\"showw\" src=\"\">");
            document.getElementById('showw').src=this.result;
        };
    })
</script>